home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / FDF101.ARJ / FDF.H < prev    next >
C/C++ Source or Header  |  1992-04-29  |  7KB  |  184 lines

  1. /*
  2.  * fdf.h
  3.  *
  4.  * prototypes for fdf.c - find duplicates.
  5.  *
  6.  * Roy Bixler (original development and Atari ST version)
  7.  * Ayman Barakat (idea)
  8.  * David Oertel (MS-DOS version)
  9.  *
  10.  * Version 1.0: March 14, 1991
  11.  * Version 1.01: April 12, 1992
  12.  *
  13.  * This program is free software; you can redistribute it and/or modify
  14.  * it under the terms of the GNU General Public License as published by
  15.  * the Free Software Foundation; either version 1, or (at your option)
  16.  * any later version.
  17.  *
  18.  * This program is distributed in the hope that it will be useful,
  19.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  * GNU General Public License for more details.
  22.  *
  23.  * You should have received a copy of the GNU General Public License
  24.  * along with this program; if not, write to the Free Software
  25.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  26.  */
  27.  
  28.  
  29.  
  30. #define PROG_NAME        "fdf"
  31. #define GETOPT_LIST "IiLlM:m:Vv?"
  32.  
  33. #define FDF_USAGE \
  34. "%s - find duplicate files\
  35. \nVersion 1.01, Copyright (c) 1992 Roy Bixler.\
  36. \n    \"fdf\" comes with ABSOLUTELY NO WARRANTY; for details type `fdf -?'.\
  37. \n    This is free software, and you are welcome to redistribute it\
  38. \n    under certain conditions.\
  39. \n\nusage: %s [-ma] [-m[cdns]] [-ilv?] path [...]\
  40. \n       where 'path' is the starting directory for finding\
  41. \n       duplicate files.\
  42. \nmatching criteria: (default = -mdns)\
  43. \n       -ma - consider name, size, date/time and contents\
  44. \n       -m[cdns] - set the matching criteria.\
  45. \n           c - file contents must match, implies 's' (sizes must match)\
  46. \n           d - date/time of files must match\
  47. \n           n - names must match\
  48. \n           s - size of files must match\
  49. \noptions:\
  50. \n       -i - interactive delete\
  51. \n       -l - long listing of duplicate files\
  52. \n       -v - verbose, print statistics\
  53. \n       -vv - very verbose, also print activity report\
  54. \n       -? - print full documentation and exit\n"
  55.  
  56. #define FDF_SCHPIEL \
  57. "fdf - find duplicate files\
  58. \nVersion 1.01, Copyright (c) 1992 Roy Bixler.\
  59. \n\
  60. \nGeneral Idea:\
  61. \n\
  62. \n    This program finds duplicate files on your disk(s).  It is\
  63. \n    possible to specify multiple disks and see duplicate files across\
  64. \n    disks.  You have control over criteria for finding duplicate\
  65. \n    files.  For the really business-like, there is an interactive\
  66. \n    delete mode that presents you with menus asking which of the\
  67. \n    duplicate files to delete.  As an option, a statistical summary of\
  68. \n    the duplicate files is printed out at the end.\
  69. \n\
  70. \nUsage:\
  71. \n\
  72. \n    fdf [-ma] [-m[cdns]] [-ilv?] path [...]\
  73. \n        where 'path' is the starting directory for finding duplicate\
  74. \n        files.\
  75. \n\
  76. \nMatching criteria:\
  77. \n\
  78. \n    Tells program what information to consider in determining whether\
  79. \n    a pair of files are duplicates or not.  The default is to consider\
  80. \n    files as duplicates if their names, modification date/times and\
  81. \n    sizes match (i.e. -mdns).\
  82. \n\
  83. \n        -ma - All.\
  84. \n            Consider name, size, date/time and contents.\
  85. \n\
  86. \n        -m[cdns] - Set the matching criteria.\
  87. \n            c - Contents.\
  88. \n                File contents must match, implies 's' (sizes must\
  89. \n                match).\
  90. \n\
  91. \n            d - Dates.\
  92. \n                Date/time of files must match.\
  93. \n\
  94. \n            n - Names.\
  95. \n                Names must match.\
  96. \n\
  97. \n            s - Sizes.\
  98. \n                Size of files must match.\
  99. \n\
  100. \nOptions:\
  101. \n\
  102. \n        -i - Interactive delete mode.\
  103. \n            Duplicate files are listed in menus.  Type in the numbers\
  104. \n            of the files you wish to delete or just hit <Return> to\
  105. \n            leave the files alone.  The numbers can be separated by\
  106. \n            commas or spaces.  Ranges of numbers can be specified by\
  107. \n            separating the lower and upper limits with a dash.\
  108. \n\
  109. \n        -l - Long listing of duplicate files.\
  110. \n            Gives date/time and size information on each duplicated\
  111. \n            file.\
  112. \n\
  113. \n        -v - Verbose, print statistics.\
  114. \n            Give information on number of files, number of duplicated\
  115. \n            files, number of duplicate names, total number of bytes\
  116. \n            and averages of each at the end.  When in 'interactive\
  117. \n            delete mode', also print out how many bytes in files you\
  118. \n            deleted.\
  119. \n\
  120. \n        -vv - Very verbose, also print activity report.\
  121. \n            In addition to printing statistics above, print out the\
  122. \n            directories searched for duplicate files.\
  123. \n\
  124. \n        -?\
  125. \n            Print full documentation and exit.  You are here!\
  126. \n\
  127. \nDifferences with 'sfdf':\
  128. \n\
  129. \n    'fdf' is faster than 'sfdf', but it does not sort the output.\
  130. \n    'fdf' also uses somewhat more memory.\
  131. \n\
  132. \nLicense:\
  133. \n\
  134. \n    This program is free software; you can redistribute it and/or modify\
  135. \n    it under the terms of the GNU General Public License as published by\
  136. \n    the Free Software Foundation; either version 1, or (at your option)\
  137. \n    any later version.\
  138. \n\
  139. \n    This program is distributed in the hope that it will be useful,\
  140. \n    but WITHOUT ANY WARRANTY; without even the implied warranty of\
  141. \n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\
  142. \n    GNU General Public License for more details.\
  143. \n\
  144. \n    You should have received a copy of the GNU General Public License\
  145. \n    along with this program; if not, write to the Free Software\
  146. \n    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\
  147. \n\
  148. \n    Please send bug reports and/or suggestions to:\
  149. \n        Roy Bixler\
  150. \n        420 S. 13th\
  151. \n        San Jose, CA 95112\
  152. \n    Include the name of the program, version and operating system.\
  153. \n\
  154. \n    Bug reports and other comments can also be sent as e-mail on the\
  155. \n        Internet to: rcb@netcom.com.\
  156. \n        UUCP: uunet!netcom.com!rcb\n"
  157.  
  158. typedef struct hash_list {
  159.     FILE_LIST *f_name;
  160.     struct hash_list *next;
  161. } HASH_LIST;
  162.  
  163.  
  164.  
  165. extern HASH_LIST *H_list[HASH_TAB_SIZE];
  166.  
  167.  
  168.  
  169. /* fdf.c */
  170. void print_help(void);
  171. void show_doc(void);
  172. void add_to_hash_table(FILE_LIST *f_name, int h_idx);
  173. void gen_hash(FILE_LIST *flist);
  174. HASH_LIST *find_duplicated_name(int *h_idx, HASH_LIST *last_found);
  175. int gen_id_menu(HASH_LIST *name_duped, FILE_LIST **menu, int max_items);
  176. void id_dups(HASH_LIST *start);
  177. void print_dups(HASH_LIST *name_duped);
  178. HASH_LIST *find_non_printed(HASH_LIST *file);
  179. void find_dups();
  180. void init_hash(void);
  181. void set_sort_hash_criteria(void);
  182. int get_options(int argc, char **argv);
  183. int main(int argc, char **argv);
  184.